<?php
/**
 * Created by PhpStorm.
 * User: luoqinghui
 * Date: 2020/7/24
 * Time: 上午17:40
 */

namespace App\Http\Controllers\Api\System;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;

/**
 * 系统设置
 */
class SystemController extends Controller{
    /**
     * 获取并发症
     */
    public function getComplication(Request $request){
        //并发症固定key
        $key = $request->input('key','');
        if ( empty($key) ) return response()->error("PARAM_EMPTY");
        $directory = DB::table('dictionary')->select(['id'])->where('key',$key)->where('status',1)->first();
        if ( empty($directory) ) {
            return response()->success();
        }
        $relust = DB::table('dictionary')->select(['id','key','value'])->where('dictionary_id',$directory->id)->where('status',1)->get();
        if ( empty($relust) ) {
            return response()->success($directory);
        }
        return response()->success($relust);
    }
}
